import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
import {JVxeTypes,JVxeColumn} from '/@/components/jeecg/JVxeTable/types'
//列表数据
export const columns: BasicColumn[] = [
   {
    title: '班级',
    align:"center",
    dataIndex: 'deptId_dictText'
   },
   {
    title: '学习状况',
    align:"center",
    dataIndex: 'studyState_dictText'
   },
   {
    title: '生活状况',
    align:"center",
    dataIndex: 'lifeState_dictText'
   },
   {
    title: '情绪状况',
    align:"center",
    dataIndex: 'emotionState_dictText'
   },
   {
    title: '创建时间',
    align:"center",
    dataIndex: 'createTime'
   },
];
//查询数据
export const searchFormSchema: FormSchema[] = [
     {
      label: "创建日期",
      field: "createTime",
      component: 'RangePicker',
      componentProps: {
          valueType: 'Date',
          showTime:true
      },
      //colProps: {span: 6},
	},
	{
      label: "班级",
      field: "deptId",
      component: 'JSelectDept',
      //colProps: {span: 6},
 	},
];
//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '班级',
    field: 'deptId',
     component: 'JSelectDept',
     slot:'deptIdSlot',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入班级!'},
          ];
     },
  },
  {
    label: '学习状况',
    field: 'studyState',
    component: 'JDictSelectTag',
    componentProps:{
        dictCode:"DORM_EMOTION_STATE"
     },
  },
  {
    label: '生活状况',
    field: 'lifeState',
    component: 'JDictSelectTag',
    componentProps:{
        dictCode:"DORM_LIFE_STATE"
     },
  },
  {
    label: '情绪状况',
    field: 'emotionState',
    component: 'JDictSelectTag',
    componentProps:{
        dictCode:"DORM_STUDY_STATE"
     },
  },
  // {
  //   label: '人员',
  //   field: 'personId',
  //   slot: 'personIdSlot',
  //   component: 'JDictSelectTag',
  //   // componentProps:{
  //   //     dictCode:"DORM_STUDY_STATE"
  //   //  },
  // },
	// TODO 主键隐藏字段，目前写死为ID
	{
	  label: '',
	  field: 'id',
	  component: 'Input',
	  show: false
	},
];
//子表单数据
//子表表格配置
export const dormMentalTsAbnormalColumns: JVxeColumn[] = [
  // {
  //   title: '人员id',
  //   key: 'personId',
  //   // type: JVxeTypes.input,
  //   // width:"200px",
  //   // placeholder: '请输入${title}',
  //   defaultValue:'',
  //   show:false,
  // },
    {
      title: '学/工号',
      // key: 'personId',
      key: 'personCode',
      type: JVxeTypes.popup,
      popupCode:"select_person",
      // popupCode:"JSelectDormPerson",
      fieldConfig: [
        { source: 'id', target: 'personId' },
        { source: 'name', target: 'personName' },
      ],
	  param:{deptId:"'3'"}, 	
      width:"200px",
      placeholder: '请输入${title}',
      defaultValue:'',
    },
	{
      title: '人员姓名',
      key: 'personName',
      type: JVxeTypes.input,
      width:"200px",
      placeholder: '请输入${title}',
      defaultValue:'',
    },
	
    {
      title: '隐患情况描述',
      key: 'hiddenTrouble',
      type: JVxeTypes.textarea,
      width:"200px",
      placeholder: '请输入${title}',
      defaultValue:'',
    },
    {
      title: '处理措施',
      key: 'handlingMeasures',
      type: JVxeTypes.textarea,
      width:"200px",
      placeholder: '请输入${title}',
      defaultValue:'',
    },
  ]


// 高级查询数据
export const superQuerySchema = {
  deptId: {title: '班级',order: 1,view: 'sel_depart', type: 'string',},
  studyState: {title: '学习状况',order: 2,view: 'radio', type: 'string',},
  lifeState: {title: '生活状况',order: 3,view: 'radio', type: 'string',},
  emotionState: {title: '情绪状况',order: 4,view: 'radio', type: 'string',},
  //子表高级查询
  dormMentalTsAbnormal: {
    title: '学生心理健康排查异常学生信息',
    view: 'table',
    fields: {
        personId: {title: '人员',order: 0,view: 'popup', type: 'string',code: 'select_person', orgFields: 'id', destFields: 'personId', popupMulti: false,},
        hiddenTrouble: {title: '隐患情况描述',order: 1,view: 'textarea', type: 'string',},
        handlingMeasures: {title: '处理措施',order: 2,view: 'textarea', type: 'string',},
    }
  },
};

/**
* 流程表单调用这个方法获取formSchema
* @param param
*/
export function getBpmFormSchema(_formData): FormSchema[]{
// 默认和原始表单保持一致 如果流程中配置了权限数据，这里需要单独处理formSchema
  return formSchema;
}